# -*-encoding:utf8-*-
import json


class GService(object):
    @classmethod
    def __init__(self):
        pass

    @classmethod
    def SOK(cls, data=None, message='success'):
        """
        返回成功调用方法
        :param data:
        :param message:
        :return:
        """
        obj = {}
        obj['data'] = data
        obj['code'] = 200
        obj['message'] = message
        print obj
        return obj

    @classmethod
    def SFAIL(cls, message, error=500, data=None):
        """
        返回失败调用方法
        :param message:
        :param error:
        :param data:
        :return:
        """
        obj = {}
        obj['data'] = data
        obj['code'] = error
        obj['message'] = message
        return obj

    @classmethod
    def VOK(cls, data=None, message='success'):
        """
        返回成功调用方法
        :param data:
        :param message:
        :return:
        """
        obj = {}
        obj['data'] = data
        obj['code'] = 200
        obj['message'] = message
        return json.dumps(obj, ensure_ascii=False, indent=2)

    @classmethod
    def VFAIL(cls, message, error=500, data=None):
        """
        返回失败调用方法
        :param message:
        :param error:
        :param data:
        :return:
        """
        obj = {}
        obj['data'] = data
        obj['code'] = error
        obj['message'] = message
        return json.dumps(obj, ensure_ascii=False, indent=2)
